package com.gainloop;

import android.content.Intent;
import android.os.Bundle;

import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TabHost;



import com.gainloop.R;
import com.gainloop.Utils.Constants;
import com.gainloop.Utils.Constants.ListType;

public class Home extends TabsActivityAbstract {
	TabHost mTabHost;
    
	@Override
	public void onCreate(Bundle savedInstanceState) { 
		super.onCreate(savedInstanceState);

		setContentView(R.layout.home);

		initHeader();
		headerTitle.setText(R.string.home);

		mTabHost = (TabHost) findViewById(R.id.homeTabhost);
		mTabHost.setup(this.getLocalActivityManager());

		mTabHost.addTab(mTabHost
				.newTabSpec("top")
				.setIndicator(
						createTabView(mTabHost.getContext(),
								R.string.top_wishes))
				.setContent(new Intent().setClass(this, WishList.class)
				.putExtra(Constants.listTypeParam,ListType.TOP)));

		mTabHost.addTab(mTabHost
				.newTabSpec("recent")
				.setIndicator(
						createTabView(mTabHost.getContext(),
								R.string.recent_wishes))
				.setContent(new Intent().setClass(this, WishList.class)
				.putExtra(Constants.listTypeParam,ListType.RECENT)));
		
		mTabHost.addTab(mTabHost
				.newTabSpec("friends")
				.setIndicator(
						createTabView(mTabHost.getContext(),
								R.string.friends_wishes))
				.setContent(new Intent().setClass(this, WishList.class)
				.putExtra(Constants.listTypeParam,ListType.FRIENDS)));
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.main_menu, menu);
		
		MenuItem mi_profile = menu.findItem(R.id.menuProfile);
		mi_profile.setIntent(new Intent(this, Profile.class));
		
		MenuItem mi_newWish = menu.findItem(R.id.menuNewWish);
		mi_newWish.setIntent(new Intent(this, AddWish.class));
		
		MenuItem mi_search_gain = menu.findItem(R.id.menuSearch); 
		mi_search_gain.setIntent(new Intent(this, GainSearch.class));
		
		MenuItem mi_people_gain = menu.findItem(R.id.menuPeople); 
		mi_people_gain.setIntent(new Intent(this, People.class));
		
		menu.removeItem(R.id.menuHome);
		return true;
	}
	

}